<h1>The Role of a File Asset Manager</h1>
<p>In web development, managing various types of files - such as JavaScript, CSS, and images - alongside PHP files can be challenging. Traditional PHP frameworks often adhere to the MVC design pattern, which does not provide a clear solution for handling non-PHP assets. This can lead to confusion and inefficiency when developing complex modules that require a variety of file types. The <b>File Asset Manager</b> in Trongate solves this issue. It does so by letting web developers store all necessary file assets - for any given module - within an <b>assets</b> sub-directory. This means that Trongate modules can be self-contained, highly-portable, and reusable.</p>
<h2>Example</h2>
<p>Consider a scenario where an invoicing system needs to be developed. In this case, a module might be created to handle the creation and management of invoices. Developing and testing such a module could take several days. Thus, having the 'invoicing' module function as a self-contained unit would be advantageous. This modular approach would allow for easy reuse of the 'invoicing' module in future projects by simply transferring the directory from one site to another. Trongate facilitates this modularity.</p>
<p>A potential challenge in this scenario would involve serving non-PHP files, such as specific JavaScript libraries, CSS files for styling invoices, or images. For example, the invoicing system might require a CSS file for invoice styling, a directory for storing company logos, or badges and logos for affiliated governing bodies. Traditional PHP frameworks do not provide an efficient way to manage these assets within the MVC design pattern.</p>
<p>Fortunately, Trongate resolves this issue. As a truly modular framework, Trongate allows modules to be entirely self-contained. This means that all necessary files for a feature, such as an invoicing system, can be included within a single module. This includes CSS, JavaScript, images, and other assets.</p>
<h2>Truly Modular</h2>
<p>Trongate's true modularity ensures that modules are self-contained. When building features like the aforementioned invoicing system, all required files can be housed within one module. This approach simplifies the process of managing and deploying features across different projects.</p>
<p>The code responsible for serving non-PHP assets within Trongate modules is known as the File Asset Manager.</p>
<p>This chapter provides detailed instructions on utilizing Trongate's File Asset Manager.</p>